﻿using System;
using System.Data;
using System.Collections.Generic;
using IPR_StudyMeetingMrgSys.Common;
using IPR_StudyMeetingMrgSys.Model;
using IPR_StudyMeetingMrgSys.DAL;
namespace IPR_StudyMeetingMrgSys.BLL
{
    /// <summary>
    /// TrainCourse
    /// </summary>
    public partial class TrainCourseFiles
    {
        private readonly IPR_StudyMeetingMrgSys.DAL.TrainCourseFiles dal = new IPR_StudyMeetingMrgSys.DAL.TrainCourseFiles();
        public TrainCourseFiles()
        { }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(IPR_StudyMeetingMrgSys.Model.TrainCourseFiles model)
        {
            return dal.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPR_StudyMeetingMrgSys.Model.TrainCourseFiles model)
        {
            return dal.Update(model);
        }


        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        public DataSet GetListView(string strWhere)
        {
            return dal.GetListView(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<IPR_StudyMeetingMrgSys.Model.TrainCourseFiles> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<IPR_StudyMeetingMrgSys.Model.TrainCourseFiles> DataTableToList(DataTable dt)
        {
            List<IPR_StudyMeetingMrgSys.Model.TrainCourseFiles> modelList = new List<IPR_StudyMeetingMrgSys.Model.TrainCourseFiles>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                IPR_StudyMeetingMrgSys.Model.TrainCourseFiles model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }


        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetSqlCount(string strSql)
        {
            return dal.GetSqlCount(strSql);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        public bool AddList(List<IPR_StudyMeetingMrgSys.Model.TrainCourseFiles> modelList, long TCOID = 0)
        {
            return dal.AddList(modelList, TCOID);
        }
        /// <summary>
        /// 根据课程编号获取培训内容列表
        /// </summary>
        public DataSet GetContentList(string TCOID)
        {
            return dal.GetContentList(TCOID);
        }
        /// <summary>
        /// 根据计划ID获取培训内容列表
        /// </summary>
        public DataSet GetTContent(string TPID)
        {
            return dal.GetTContent(TPID);
        }


        /// <summary>
        /// 乘务员学习内容统计
        /// </summary>
        public DataSet StudyContentSearch(string sql)
        {
            return dal.StudyContentSearch(sql);
        }
    }
}

